<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://corejsf.com/validator">

<f:view>
<f:loadBundle var="text" basename="#{questionnaireForm.bundleName}"/>
    <head>
        <title>#{text['questionnaireDetail.title']}</title>
        <meta name="heading" content="#{text['questionnaireDetail.heading']}"/>
        <style type="text/css">
            .jscalendar-DB-div-style {
                position: absolute;
                margin-top: -120px;
                margin-left: -508px;
            }
    </style>
    </head>
<body id="questionnaireForm">

<h:form id="questionnaireForm" onsubmit="return validateQuestionnaireForm(this)">
<h:inputHidden value="#{questionnaireForm.questionnaire.questionnaireId}" id="questionnaireId"/>
<h:panelGrid columns="3">
    <h:outputLabel styleClass="desc" for="description" value="#{text['questionnaire.description']}"/>
    <t:message for="description" styleClass="fieldError"/>
    <h:inputText styleClass="text medium" id="description" value="#{questionnaireForm.questionnaire.description}" required="false" maxlength="255">
    </h:inputText>
    <h:outputLabel styleClass="desc" for="title" value="#{text['questionnaire.title']}"/>
    <t:message for="title" styleClass="fieldError"/>
    <h:inputText styleClass="text medium" id="title" value="#{questionnaireForm.questionnaire.title}" required="false" maxlength="255">
    </h:inputText>

    <h:panelGroup styleClass="buttonBar bottom">
        <h:commandButton value="#{text['button.save']}" action="#{questionnaireForm.save}" id="save" styleClass="button"/>

        <c:if test="${not empty questionnaireForm.questionnaire.questionnaireId}">
        <h:commandButton value="#{text['button.delete']}" action="#{questionnaireForm.delete}"
            id="delete" styleClass="button" onclick="bCancel=true; return confirmDelete('Questionnaire')"/>
        </c:if>

        <h:commandButton value="#{text['button.cancel']}" action="questionnaireList" immediate="true"
            id="cancel" styleClass="button" onclick="bCancel=true"/>
    </h:panelGroup>
    <h:outputText/><h:outputText/>
</h:panelGrid>
</h:form>

<v:validatorScript functionName="validateQuestionnaireForm"/>

<script type="text/javascript">
    //Form.focusFirstElement($('questionnaireForm'));
    highlightFormElements();
</script>

</body>
</f:view>
</html>
